/*************************************************************************
	> File Name: rerandmomizationTest.c
	> Author: 
	> Mail: 
	> Created Time: Sat 15 Apr 2017 03:58:28 PM PDT
 ************************************************************************/

#include<stdio.h>
struct T{
    int a;
    int b;
    int c;
    int (*cmp)(int a,int b);
};

struct B{
    int a;
    int (*calculate)(struct T*,int (*)(int,int));
    struct T* B_T;
};


int cmp(int a, int b){
    return a-b;
}

int arth(struct T* operand, int (*arth_cmp)(int,int)){
    int result = arth_cmp(operand->a,operand->b);

    if(result){
        return operand->a + operand->b;
    }
    return operand->a - operand->b;
}

int add(int b,int a){
    return b+a;
}

int main(){
    struct B b;
    struct B * bp;
    struct T t;
    struct T * tp;
    int result;

    b.B_T = &t;
    b.B_T->a =1;
    b.B_T->b =3;
    b.calculate = arth;
    b.B_T->cmp= cmp;
    result = b.calculate(b.B_T, b.B_T->cmp);
    printf("result %d\n",result);
}
